package com.hit.aircraftwar.difficulty;


import com.hit.aircraftwar.aircraft.AbstractAircraft;
import com.hit.aircraftwar.creator.BossCreator;
import com.hit.aircraftwar.creator.Creator;
import com.hit.aircraftwar.creator.EliteEnemyCreator;
import com.hit.aircraftwar.creator.MobEnemyCreator;
import com.hit.aircraftwar.setter.ParameterSet;

public class MediumDiff extends DifficultyClass {

    ParameterSet parameterSet = ParameterSet.getInstance();
    Creator creator;

    @Override
    AbstractAircraft creatEnemy(int enemySize, int timeWithoutElite, int score) {
        AbstractAircraft aircraft = null;
        if (enemySize < parameterSet.getMaxEnemy()) {
            if (parameterSet.noElite() && timeWithoutElite >= parameterSet.getEliteInterval()) {
                creator = new EliteEnemyCreator();
                aircraft = (AbstractAircraft) creator.creatObject();
                parameterSet.setHasElite(true);
                System.out.println("精英敌机出现！");
            } else if(!parameterSet.getHasBoss() && score % parameterSet.getBossScoreInterval() <= 80 && score >= parameterSet.getBossScoreInterval()) {
                creator = new BossCreator();
                aircraft = ((AbstractAircraft) creator.creatObject());
                parameterSet.setHasBoss(true);
                System.out.println("BOSS出现！");
            } else {
                creator = new MobEnemyCreator();
                aircraft = ((AbstractAircraft) creator.creatObject());
            }
        }
        return aircraft;
    }
}
